#ifndef _MAIN_H
#define _MAIN_H

//#include <queue>
#include <deque>
#include <event2/bufferevent.h>
#include <strings.h> //bzero
#include <iostream>
/*
*@filename:main.h
*@desc:the game's basic definitions
*/

#define CLIENT_ROW_CNT 40
#define CLIENT_COL_CNT 40


#define SERVER_PORT     8888

typedef enum {
    UP = 1,
    DOWN,
    LEFT,
    RIGHT,
    NONE_DIR
}SnakeDir;

typedef enum {
    EASY = 0,
    MID,
    DIFFICULT
}SnakeSpd;/*speed*/

typedef enum {
    START_GAME = 1,
    DATA_ERROR,
    EXIT_GAME,
    NONE_CMD
}GameCmd;

typedef enum {
    GAME_MENU = 0,
    GAME_STARTED = 1,
    GAME_OVER,/*由于游戏规则，被动结束*/
    GAME_EXITED,/*客户端主动结束*/
}GameStat;



#if 0 //传统C语言方式
typedef struct 
{
    int x;
    int y;
}FoodNode;
#endif 
typedef struct
{
    int x;
    int y;
    SnakeDir dir;
}SnakeNode;

typedef struct 
{
    int m_socket_fd;
    //struct sockaddr_in socket_addr;
    struct bufferevent *bev;
    GameStat m_stat;
    unsigned char m_score;
}PlayerInfo;

#endif